export default {
  data() {
    return {
      register: {
        repeatPassword: '',
        userName: '',
        password: '',
        userPhone: '',
        authCode: '',
        imgCode: '',
        uuid:'', // 生成图形验证码 uuid
      },
      registerRules1: {
        userName: [
          { required: true,trigger: "blur",message: '请输入用户名' }
        ],
        userPhone: [
          {required: true,trigger: "blur",message: '手机号码不能为空'},
          {
            trigger: "blur",
            validator: (rule, value, callback) => {
              this.regCheck('phone', value) ? callback('手机号码格式不正确') : callback()
            },
          },
        ],
        authCode: [
          { required: true,trigger: "blur",message: '请输入手机验证码' },
        ],
        imgCode: [
          { required: true,trigger: "blur",message: '请输入图片验证码' },
        ]
      },
      registerRules2: {
        password: [
          { required: true,trigger: "blur",message: '请输入用户密码' },
          {
            trigger: "blur",
            validator: (rule, value, callback) => {
              this.regCheck('password', value) ? callback('密码6-18位，至少同时包含数字、大小写字母') : callback()
            }
          }
        ],
        repeatPassword: [
          {required: true,trigger: "blur",message: '请输入重复密码'},
          {
            trigger: "blur",
            validator: (rule, value, callback) => {
              if (this.regCheck('password', value)) {
                callback(new Error("密码6-18位，至少同时包含数字、大小写字母"));
              } else if (this.register.password && this.register.password !== value) {
                callback(new Error("重复密码和用户密码不一致"));
              } else {
                callback();
              }
            },
          },
        ],
      }
    }
  }
}
